import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Req,
  HttpCode,
} from '@nestjs/common';
import { ChangeuserService } from './changeuser.service';
import { CreateChangeuserDto } from './dto/create-changeuser.dto';
import { UpdateChangeuserDto } from './dto/update-changeuser.dto';
import { Auth } from '@/jwt/jwt.decorator';
import { changeUserInfoPassWordDto } from './dto/changeUserPassWord.dto';
import { findUserInfoPassWord } from './dto/findPassWord.dto';

@Controller('changeuserinfo')
export class ChangeuserController {
  constructor(private readonly changeuserService: ChangeuserService) {}

  //修改用户信息
  @Patch()
  @Auth()
  update(@Body() dto: CreateChangeuserDto, @Req() req: any) {
    return this.changeuserService.update(dto, req);
  }

  //修改密码
  @Auth()
  @HttpCode(200)
  @Post('password')
  updateUserPassWord(@Body() dto: changeUserInfoPassWordDto, @Req() req: any) {
    return this.changeuserService.updateUserPassWord(dto, req);
  }

  //找回密码
  @Post('findPassWord')
  @HttpCode(200)
  findPassWord(@Body() dto: findUserInfoPassWord) {
    return this.changeuserService.findUserPassWord(dto);
  }
}
